﻿using System.Drawing;
using System.Windows.Forms;
namespace RPG1
{
    class Hero : Role
    {
        public Hero(string name, int originalLife, int currentLife, int damage,
            PictureBox picBox, Label bottomLabel, Label topLabel)
            : base(name, originalLife, currentLife, damage, picBox, bottomLabel, topLabel)
        {
            //继承自父类的属性
            Name = name;
            OriginalLife = originalLife;
            CurrentLife = currentLife;
            Damage = damage;
            PicBox = picBox;
            BottomLabel = bottomLabel;
            TopLabel = topLabel;
        }
        public void move(Monster monster)
        {
            // 移动到怪兽面前
            int diffX = monster.PicBox.Location.X + monster.PicBox.Width
                - PicBox.Location.X;
            int diffY = monster.PicBox.Location.Y - PicBox.Location.Y - 10;
            
            for (int i = 1; i <= 10; i++) {
                PicBox.Location = new Point(PicBox.Location.X + diffX / 10,
                   PicBox.Location.Y + diffY/ 10);
                BottomLabel.Location = PicBox.Location;
                TopLabel.Location = PicBox.Location;
                Delay();
            }
            move();
        }
    }
}
